package ru.ifmo.swing.genetics;

import ru.ifmo.swing.EvolutionControlWithConfigProvider;

import javax.swing.*;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Roman Kolganov
 *         16.05.12
 */
public class TextFieldConfigProvider implements EvolutionControlWithConfigProvider {

    private JTextField control;
    private String name;

    public TextFieldConfigProvider(JTextField control, String name) {
        this.control = control;
        this.name = name;
    }

    public Map<String, Object> getParamValues() {
        Map<String, Object> res = new HashMap<String, Object>();
        res.put(name, control.getText());
        return res;
    }

    public JComponent getControl() {
        return control;
    }

    public void reset() {
    }

    public void setDescription(String description) {
    }
}
